package com.hs.p1;

public class User {
    private String userName;
    private String password;
    private long registrationTime;
//用代码块对构造器中的重复代码进行优化
    {
        System.out.println("新用户注册");
        registrationTime=System.currentTimeMillis();
    }
    public User() {

        password="123456";
    }

    public User(String password, String userName) {
//        System.out.println("新用户注册");
//        registrationTime=System.currentTimeMillis();
        this.password = password;
        this.userName = userName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public long getRegistrationTime() {
        return registrationTime;
    }
    public String getInfo(){
        return "用户名："+userName+",密码："+password+",注册时间"+registrationTime;
    }

}
